package com.ruibang.glass.produce.controller.system;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruibang.glass.produce.constant.Constants;
import com.ruibang.glass.produce.domain.req.ProcessAdjustmentReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ruibang.glass.produce.service.ProcessAdjustmentService;
import com.ruibang.glass.produce.entity.ProcessAdjustment;

import javax.validation.Valid;


/**
 * <p>
 * 工艺调整 前端控制器
 * </p>
 *
 * @author songJinKang
 * @since 2024-03-15
 */
@RestController
@RequestMapping("/api/glass/produce/process/adjustment")
@Api(value = "工艺调整控制器", tags = {"工艺调整接口"})
public class ProcessAdjustmentController {

    @Autowired
    private ProcessAdjustmentService processAdjustmentService;

    @GetMapping("/getById/{id}")
    @ApiOperation(value = "获取工艺调整", notes = "获取工艺调整")
    public ResultBody getById(@PathVariable(value = "id") String id) {
        return ResultBody.success(processAdjustmentService.getById(id));
    }

    @PostMapping("/save")
    @ApiOperation(value = "新增工艺调整", notes = "新增工艺调整")
    public ResultBody save(@RequestBody @Valid ProcessAdjustment processAdjustment) {
        processAdjustmentService.insert(processAdjustment);
        return ResultBody.success();
    }

    @GetMapping("/deleteById/{id}")
    @ApiOperation(value = "通过ID删除工艺调整", notes = "通过ID删除工艺调整")
    public ResultBody delete(@PathVariable(value = "id") String id) {
        processAdjustmentService.delete(id);
        return ResultBody.success();
    }

    @PostMapping("/update")
    @ApiOperation(value = "修改工艺调整", notes = "修改工艺调整")
    public ResultBody updateById(@RequestBody ProcessAdjustment processAdjustment) {
        processAdjustmentService.updateById(processAdjustment);
        return ResultBody.success();
    }

    @PostMapping("/pageQuery")
    @ApiOperation(value = "分页列表查询工艺调整", notes = "分页列表查询工艺调整")
    public ResultBody<IPage<ProcessAdjustment>> pageQuery(@RequestBody ProcessAdjustmentReq processAdjustmentReq) {
        return ResultBody.success(processAdjustmentService.pageQuery(processAdjustmentReq));
    }
}
